<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="description" content="Reflect Template" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
        <title><?php echo $this->config->item("title")?></title>
        <link rel="stylesheet" href="<?php echo base_url()?>css/style_all.css" type="text/css" media="screen" />
        <link rel="stylesheet" href="<?php echo base_url()?>css/style3.css" type="text/css" media="screen" />
        <link rel="stylesheet" href="<?php echo base_url()?>css/jquery-ui.css" type="text/css" media="screen" />
        <link rel="stylesheet" href="<?php echo base_url()?>css/jquery.wysiwyg.css" type="text/css" media="screen" />
        <!--Internet Explorer Trancparency fix-->
        <!--[if IE 6]>
        <script src="<?php echo base_url()?>js/ie6pngfix.js"></script>
        <script>
          DD_belatedPNG.fix('#head, a, a span, img, .message p, .click_to_close, .ie6fix');
        </script>
        <![endif]--> 
        
        <script type='text/javascript' src='<?php echo base_url()?>js/jquery.js'></script>
        <script type='text/javascript' src='<?php echo base_url()?>js/jquery-ui.js'></script>
        <script type='text/javascript' src='<?php echo base_url()?>js/jquery.wysiwyg.js'></script>
        <script type='text/javascript' src='<?php echo base_url()?>js/custom.js'></script>
        <script type='text/javascript' src='<?php echo base_url()?>js/validation.js'></script>
        <script type="text/javascript">
	        
        	jQuery(function($) {
        		$.validator.setDefaults({
    	        	submitHandler: function() {
    	        	
					var remember="0";
    	        	if ($("#checkbox1").attr("checked")) {
        	        	remember ="1";
					}
        			$(".login_message").find("div").hide(200);
        			need_captcha();
	        			$.ajax({
	        				type: "post",
	        				url: "<?php echo base_url()?>index.php/common_login_manage/login",
	        				data:{user_name:$("#user_name").val(),password:$("#password").val(),captcha:$("#captcha").val(),remember:remember},
	        				dataType:"json",
	        				beforeSend: function(XMLHttpRequest){
	        					$(".login_clearboth").html("正在提交...");
	        				},
	        				success: function(data, textStatus){
	        			        if(data.result==false){
	        			        	$(".login_message").find("div").show(200);
	            					$(".login_message").find("p").text(data.message);
	            					$(".login_clearboth").html("<input class=\"button\" id=\"login_button\" name=\"submit\" type=\"submit\" value=\"登  录\"/>");
	                			}else{
	                				$("#cboxOverlay").hide();
	                				$("#colorbox").hide();
		                		}
	        				},
	        				complete: function(XMLHttpRequest, textStatus){
	        					
	        				},
	        				error: function(){
	        					$(".login_message").find("div").show(200);
	        					$(".login_message").find("p").text("登录请求失败,请检查你的网络.");
	        					$(".login_clearboth").html("<input class=\"button\" id=\"login_button\" name=\"submit\" type=\"submit\" value=\"登  录\"/>");
	        				}
        				});
    	        	}
    	        });
        	  	$("#login-form").validate();

        	  	$("#user_name").blur(function(){
					if ($(this).val()!="") {
						need_captcha();
					}
            	});
				function need_captcha(){
					$.ajax({
        				type: "post",
        				url: "<?php echo base_url()?>index.php/common_login_manage/need_captcha",
        				data:{user_name:$("#user_name").val()},
        				dataType:"json",
        				beforeSend: function(XMLHttpRequest){
        					
        				},
        				success: function(data, textStatus){
        			        if(data.result==true){
								$(".captcha").show(200);
	        			       }else{
	        			    	$(".captcha").hide(200);
		        			    }
        				},
        				complete: function(XMLHttpRequest, textStatus){
        					
        				},
        				error: function(){
        					$(".login_message").find("div").show(200);
        					$(".login_message").find("p").text("登录请求失败,请检查你的网络.");
        				}
        			});

				}
            	$("#change_captcha").click(function(){
            		$(".captcha").attr("src","<?php echo base_url()."index.php/common_captcha";?>");
                });
        	});
        </script>
    </head>
    
    
    <body >    	
        <div id="top">
            
            
          	<div id="login">
          		<div class="login_message" >
	        		<div class="message error" style="display:none;">
	          			<p></p>
	        		</div>
        		</div>
	        	<form id="login-form" action="index.html" method="post">
	            <p>
	            	<label for="name">用户名</label>
	            	<input class="input-medium" type="text" value="<?php echo $user_name?>" name="user_name" id="user_name" required />
	        	</p>
	        	<p>
	            	<label for="password">密码</label>
	            	<input class="input-medium" type="password" value="" name="password" id="password" required/>
	            	
	        	</p>
	        	<p class="captcha" style="display:none;">
	            	<label for="password">验证码</label>
	            	<input class="input-small" type="text" value="" name="captcha" id="captcha" />
	            	<img src="<?php echo base_url()."index.php/common_captcha"?>" alt="" class="captcha" />
	            	<a href="javascript:void(0)" id="change_captcha">看不清?</a>
	            	
	        	</p>
	        
	        	<p class="remember">
	            	<label for="checkbox1" class="inline">记住用户名</label>
	            	<input type="checkbox" value="1" name="checkbox1" id="checkbox1" <?php echo $user_name==""?"":"checked=\"checked\"";?>  />
	        	</p>
	        	<div class="forgot_pw">忘记密码?</div>
	        	<p class="login_clearboth">
	            	<input class="button" id="login_button" name="submit" type="submit" value="登  录"/>
	        	</p>
	            </form>
        	</div>
        
        </div><!-- end top -->
	</body>
</html>